package com.socket;

import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetAddress;

public class UDPServer {

    public static void main(String[] args) throws Exception {
        DatagramSocket server = new DatagramSocket(8000);
        String message = "hello udp from server";
        DatagramPacket packet = new DatagramPacket(message.getBytes(),0,
                message.length(), InetAddress.getByName("localhost"),9122);
        server.send(packet);
        System.out.println("UDPServer 数据信息发送完毕.....");
        server.close();
    }
}
